#include "globals.h"
#include "recipient.h"
#include "smssend.h"
#include "ui_smssend.h"

SmsSend::SmsSend(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SmsSend)
{
    ui->setupUi(this);
}

SmsSend::~SmsSend()
{
    delete ui;
}

void SmsSend::showEvent(QShowEvent *)
{
    ui->comboBox->clear();
    RecipientGroup users = globals->userBase.allUsers();
    foreach(CRecipient *r, users)
    {
        ui->comboBox->addItem(r->name + "(" + r->phone + ")",r->phone);
    }
}

void SmsSend::on_pushButton_clicked()
{
    globals->queueAddMessage(ui->textEdit->toPlainText(),ui->comboBox->itemData(ui->comboBox->currentIndex()).toString());
}
